<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="includes.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<% String basePath = request.getContextPath();%>
<% String baseCSSPath = request.getContextPath()+"/resources/css";%>
<% String baseJSPath = request.getContextPath()+"/resources/js";%>
<% String baseImagePath = request.getContextPath()+"/resources/images";%>


<title>订单结算</title>

<link href="<%=baseImagePath%>/favicon.png" rel="icon">
<link href="<%=baseCSSPath%>/stylesheet.css" rel="stylesheet" type="text/css" >
<script src="<%=baseJSPath %>/jquery-1.js" type="text/javascript" ></script>
<script src="<%=baseJSPath %>/jquery_004.js" type="text/javascript" ></script>
<script src="<%=baseJSPath %>/script.js" type="text/javascript" ></script>
<script src="<%=baseJSPath %>/common.js" type="text/javascript" ></script>
<script src="<%=baseJSPath %>/jquery.validate.min.js" type="text/javascript" ></script>
<script src="<%=baseJSPath %>/jquery.validate.message.js" type="text/javascript" ></script>

<script language="javascript">

var selectedAddressId = -1;

$(document).ready(function() {
	
	$("#submitOrderId").click(function() {
		if(selectedAddressId==-1){
			$('#notification').html('<div class="success" style="fontdisplay: none; font-size: 80% ">错误信息：<font color="red"> 对不起，请您先选择送货地址</font><span><img src="/CommerceFrame/resources/images/close.png" alt="" class="close" /></span></div>');
			$('.success').fadeIn('slow');
			return;
		}
		document.getElementById("selectedAddress").value=selectedAddressId;
		alert($("#orderSubmitForm"));
		document.getElementById("orderSubmitForm").submit();
	});
});

</script>

</head>

<body class="account-login">
	<div class="main-shining">
		
<p style="display: block;" id="back-top"> <a href="#top"><span></span></a> </p>
<div class="row-1">
     <%@ include file="header.jsp" %>
   </div>
<div id="container">
<div id="notification"> </div>
<div id="column-left">
    <%@ include file="navMenu.jsp" %>
 </div>
 
<div id="content">
  <div class="breadcrumb">
        <a href="">首页</a>
         &gt;&gt; <a href="">购物车</a>
         &gt;&gt; <a class="last" href="">订单结算</a>
      </div>
      
 <%
 boolean displayCheckout_flag = false;
 if(currentUser!=null){
	 if(currentUser.getProductInstanceListOfSession()!=null && currentUser.getProductInstanceListOfSession().size()>0){
		 displayCheckout_flag = true;
	 }else{
		 Object myOrderId = request.getAttribute("orderId");
		 if(myOrderId!=null && !"".equals(myOrderId.toString())){
			 displayCheckout_flag = true;
		 }
	 }
 }
 %> 
 
 <%if(!displayCheckout_flag){ %>  
 您当前的购物车为空,请您继续购物.
 <%}else{ %>  
  <h1>订单结算</h1>
  
<div class="box-container" id="addressList">
	
	
</div>
 <br>

<div class="box-container">
<div class="login-content">
  <h2>第二步: 付款方式</h2>
<img src="<%=baseImagePath %>/pic_bank.gif"> </img>
</div>
<br/><br/>
  <form method="post" action="order/orderSubmit.html" id="orderSubmitForm">
  <input type="hidden" name="addressId" id="selectedAddress"/>
  <input type="hidden" name="orderId" value="${orderId}"/>
	  <div class="buttons">
	    <div class="center"><a class="button" id="submitOrderId" ><span>提交订单</span></a></div>
	  </div>
  </form>
</div>
<br/>

<%} %>
 
</div>



<script type="text/javascript"><!--

$('#addressList').load('shoppingCart/addressList.html');
 

//--></script> 
</div>
<div class="footer-wrap">
	<%@ include file="footer.jsp" %>
</div>
 
</div>

</body></html>